package com.boc.ewr.util;

import lombok.extern.slf4j.Slf4j;

import java.util.Arrays;
import java.util.Optional;

/**
 * @author : Wzz
 * @create : 2023-05- 23- 14:33
 * @desc : 消息类型（通告类型）枚举
 */
@Slf4j
public enum MsgCategoryEnum {

    NOTICE("1", "通知公告"),
    SYSTEM("2", "系统消息"),
    DATA_SEND("5", "数据推送提醒"),
    RISK_CHECK("6", "风险核查提醒"),
    CA_TASK( "3","对账任务提醒"),
    COLLECTION( "4","智能催收提醒"),
    TEMP_WORK("9","临时性工作推送提醒"),
    BILL_MSG("7","账单信息确认"),
    PROCESS_RESULT("8","申请审批结果提醒"),
    PROCESS_QUESTION("9","制度及流程-提问");

    private String index;
    private String value;

    MsgCategoryEnum(String index, String value) {

        this.index = index;
        this.value = value;
    }

    /**
     * 根据value获取枚举对象
     *
     * @param val
     * @return
     */
    public static MsgCategoryEnum getIndexByValue(String val) {
        Optional<MsgCategoryEnum> first = Arrays.stream(MsgCategoryEnum.values()).filter(e -> e.getValue().equals(val)).findFirst();
        MsgCategoryEnum expEnum = first.orElse(null);
        log.info("选择的枚举类型是：" + expEnum.toString());
        return expEnum;
    }

    public String getIndex() {
        return index;
    }

    public void setIndex(String index) {
        this.index = index;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }
}
